Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support HJSON #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

westonganger
Copy link
Contributor

As described in locomotivecms/engine#1321

Website: https://hjson.org/
Ruby gem: https://github.com/hjson/hjson-rb

HJSON adds the following features to JSON:

  • Trailing Commas
  • Comments (#, //, /* */)
  • Quoteless Keys
  • Quoteless String (meh but okay why not)
  • Write multiline strings with proper whitespace handling.

@did
Copy link
Member

did commented Jun 22, 2019

hey @westonganger, I wasn't aware of this gem! Looks awesome but the ruby implementation doesn't have a good SyntaxError exception in the sense that it doesn't report the line number where the error occurs.
I know that hjson is highly permissive so it might look minor but I believe it's important.
I don't mention that other developers would stick to the old JSON format.

Why not enabling hjson per Wagon site? What are your thoughts? Have you already built sites with this syntax?

@westonganger
Copy link
Contributor Author

Sure we could enable it per project. Maybe we add this key within config/site.yml

### For more permissive JSON syntax we can use HJSON, https://hjson.org/
### when set to true, the `hjson` gem must be included within your Gemfile
hjson: false

@westonganger
Copy link
Contributor Author

westonganger commented Jun 23, 2019

Also I may try to see if we can add line number reporting to the HJSON gem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants